<?

function smarty_function_link( $params, $smarty ) {

	// make sure we have dependent plugins
	$smarty->depend( 'modifier', 'escape' );

	// fetch the url for the request
	$urlHash = Smutty_Utils::strToHash( $params['url'] );
	$url = Smutty_Utils::getUrl( $urlHash );
	$update = $params['update'];
	$handler = $params['handler'];
	$feedback = $params['feedback'];
	$text = $params['text'] ? $params['text'] : ucfirst($urlHash['action']);

	// create the link!
	if ( $update )
		echo '<a href="javascript:smutty_ajaxCall(' .
				'\'' . $url . '\',' .
				'\'' . $update . '\',' .
				'\'' . $handler . '\',' .
				'null,' .
				'\'' . $feedback . '\'' .
			');">' . smarty_modifier_escape($text) . '</a>';
	else
		echo '<a href="' . $url . '">' .
			smarty_modifier_escape($text) . '</a>';

}

?>